﻿@using Remotely.Shared.Models
@inject IApplicationConfig AppConfig
@inject IDataService DataService

@{ 
    RemotelyUser user = User.Identity.IsAuthenticated ?
        DataService.GetUserByName(User.Identity.Name) :
        null;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=550, user-scalable=no" />
    <link rel="icon" href="~/favicon.ico" />
    <title>@ViewData["Title"] - Remotely</title>
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="mobile-web-app-capable" content="yes" />
    <meta name="description" content="Remote access tools designed to get things done quickly." />
    <link href="~/manifest.json" rel="manifest" />
    <link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
    <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
    <link href="~/lib/fontawesome/css/all.min.css" rel="stylesheet" />

    @if (user is RemotelyUser)
    {

        switch (user.UserOptions.Theme)
        {
            case Remotely.Shared.Enums.Theme.Light:
                <link rel="stylesheet" href="~/css/Themes/yeti.min.css" />
                <link rel="stylesheet" href="~/css/Themes/yeti.custom.css" asp-append-version="true" />
                break;
            case Remotely.Shared.Enums.Theme.Dark:
                <link rel="stylesheet" href="~/css/Themes/cyborg.min.css" />
                <link rel="stylesheet" href="~/css/Themes/cyborg.custom.css" asp-append-version="true" />
                break;
            default:
                break;
        }
    }
    else
    {
        if (AppConfig.Theme.ToLower() == "light")
        {
            <link rel="stylesheet" href="~/css/Themes/yeti.min.css" />
            <link rel="stylesheet" href="~/css/Themes/yeti.custom.css" asp-append-version="true" />
        }
        else
        {
            <link rel="stylesheet" href="~/css/Themes/cyborg.min.css" />
            <link rel="stylesheet" href="~/css/Themes/cyborg.custom.css" asp-append-version="true" />
        }
    }


    <environment include="Development">
        <script src="~/lib/jquery/dist/jquery.js"></script>
        <script src="~/lib/popper.js/popper.js"></script>
        <script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
        <script src="~/lib/signalr/signalr.js"></script>
        <script src="~/lib/signalr/msgpack5.js"></script>
        <script src="~/lib/signalr/signalr-protocol-msgpack.js"></script>
    </environment>
    <environment exclude="Development">
        <script src="~/lib/jquery/dist/jquery.min.js"></script>
        <script src="~/lib/popper.js/popper.min.js"></script>
        <script src="~/lib/bootstrap/dist/js/bootstrap.min.js"></script>
        <script src="~/lib/signalr/signalr.min.js"></script>
        <script src="~/lib/signalr/msgpack5.min.js"></script>
        <script src="~/lib/signalr/signalr-protocol-msgpack.min.js"></script>
    </environment>

    <script src="~/lib/require.js"></script>

</head>
<body>
    <header>
        <nav class="navbar navbar-dark bg-primary navbar-expand-sm navbar-toggleable-sm mb-3">
            <div class="container">
                <a class="navbar-brand" asp-area="" asp-page="/Index">
                    <div>
                        @if (user is RemotelyUser &&
                           !string.IsNullOrWhiteSpace(user?.Organization?.OrganizationName))
                        {
                            @user.Organization.OrganizationName
                        }
                        else
                        {
                            @Html.Raw("Remotely")
                        }
                    </div>
                    <div class="logo-subtitle">Support Portal</div>
                </a>
                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
                        aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                </button>
                <div class="navbar-collapse collapse d-sm-inline-flex flex-sm-row-reverse">
                    <partial name="_LoginPartial" />
                    <ul class="navbar-nav flex-grow-1">
                        <li class="nav-item">
                            <a class="nav-link" asp-area="" asp-page="/Index">Home</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" asp-area="" asp-page="/Agents">Downloads</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" asp-area="" asp-page="/RemoteControl">Remote Control</a>
                        </li>
                    </ul>
                </div>
            </div>
        </nav>
    </header>

    <div class="container">
        <main role="main">
            @RenderBody()
        </main>
    </div>
    <footer class="footer text-muted">
        <div class="container">
            <hr />
            <div class="footer-wrapper">
                <p>&copy; @DateTimeOffset.Now.Year - Translucency Software</p>
                <p class="text-right">
                    <a asp-page="/About">About Remotely</a> - <a asp-area="" asp-page="/Privacy">Privacy</a>
                </p>
            </div>
        </div>
    </footer>


    <script src="~/site.js"></script>
    @RenderSection("Scripts", required: false)
</body>
</html>
